{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%run main.py\n",
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "\n",
    "!mkdir -p {RAW_DIR}\n",
    "s3 = S3()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# !wget https://storage.yandexcloud.net/natasha-corus/GramEval2020-master.zip -P {RAW_DIR}\n",
    "# !unzip {RAW_DIR}/GramEval2020-master.zip -d {RAW_DIR}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "for target in [NEWS, FICTION]:\n",
    "    paths = (\n",
    "        join(GRAMRU_DIR, _)\n",
    "        for _ in GRAMRU_FILES[target]\n",
    "    )\n",
    "    records = (\n",
    "        record\n",
    "        for path in paths\n",
    "        for record in load_dataset(path)\n",
    "    )\n",
    "    records = log_progress(records, desc=target)\n",
    "    items = (_.as_json for _ in records)\n",
    "    lines = format_jl(items)\n",
    "    dump_gz_lines(lines, target)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "s3.upload(NEWS, S3_NEWS)\n",
    "s3.upload(FICTION, S3_FICTION)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
